package com.hut.oa.model.bean;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;

/**
 * 评价回复回复
 * @author 郑单单
 *
 */
@Entity
@Table(name="comment_reply")
public class CommentReply {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="cr_id")
	private Long id;//回复id
	
	@Column(name="cr_content",nullable=false)
	private String content;//内容
	
	@Temporal(TemporalType.DATE)
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@Column(name="cr_time",nullable=false)
	private Date time=new Date();//发表时间
	
	@OneToOne  
	@JoinColumn(name="cr_user_id")
	private User user;//回复用户
	
	@ManyToOne()
	@JoinColumn(name="cr_dc_id")
	private DiscussComment comment;//对应一个评价

	public CommentReply() {}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public DiscussComment getComment() {
		return comment;
	}

	public void setComment(DiscussComment comment) {
		this.comment = comment;
	}

	@Override
	public String toString() {
		return "CommentReply [id=" + id + ", content=" + content + ", time=" + time + "]";
	}
	
	
}
